package com.devilwwj.http;

import android.support.v7.app.ActionBarActivity;

import com.devilwwj.http.callback.OnGlobalExceptionListener;
import com.devilwwj.http.core.RequestManager;
import com.devilwwj.http.exception.HttpException;

/**
 * Created by devilwwj on 15/7/25.
 */
public class BaseActivity extends ActionBarActivity implements OnGlobalExceptionListener {

    @Override
    public boolean handleException(HttpException e) {
        // TODO RELOGIN
        if (e.statusCode == 403) {
            if ("token invalid".equals(e.responseMessage)) {
                return true;
            }

        }
        return false;
    }

    @Override
    protected void onStop() {
        super.onStop();
        RequestManager.getInstance().cancelRequest(toString());
    }
}
